package com.sfc.spiderweb.serializer;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.sfc.spiderweb.eunm.AmazonViolationDataTypeEnum;
import org.springframework.util.StringUtils;

import java.io.IOException;

public class AmazonViolationDataDeserialize extends JsonDeserializer<String> {


    @Override
    public String deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
        if (!StringUtils.isEmpty(jsonParser)) {
            String value = jsonParser.getText();
            return AmazonViolationDataTypeEnum.getEnumFlg(value);
        }
        return null;
    }
}
